home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / POV-Ray 3.0.2 / src / POV-Ray Build Extras / Magic Lamp / Magic Lamp.inc < prev    next >
Encoding:
Text File  |  1996-06-30  |  2.9 KB  |  124 lines  |  [TEXT/ttxt]

  1. // ----------------------------------------------------------
  2. // Magic Arabian Lamp, by Eduard Schwan
  3. // Copyright 1995-1996, POV-Ray Team, All Rights Reserved
  4. // ----------------------------------------------------------
  5.  
  6. // ----------------------------------------------------------
  7. //   Lamp
  8. // ----------------------------------------------------------
  9.  
  10. //    ______
  11. //    \____/
  12. //
  13. #declare LampDish_Shape =
  14. sphere
  15. {
  16.   0,1
  17.   clipped_by { box { <-1,-1,-1>, <+1,-0.5,+1> } }
  18.   bounded_by { clipped_by }
  19.   scale <2.0, 1, 1>  // make it a long trough
  20.   translate +0.5*y // move it up to touch origin
  21. }
  22.  
  23. //      _
  24. //     / \
  25. //    -----
  26. //
  27. #declare LampPedestal_Shape =
  28. torus
  29. {
  30.   1.0, 0.95 sturm
  31.   clipped_by { cylinder { 0.0*y, -1.1*y, 0.3 } }
  32.   bounded_by { clipped_by }
  33.   scale <2.5, 1, 1>  // make it a long pedestal
  34.   translate -0.4*y // move down to touch dish
  35. }
  36.  
  37. //     _/\_
  38. //
  39. #declare LampCover_Shape =
  40. torus
  41. {
  42.   1.0, 1.0 sturm
  43.   clipped_by { cylinder { 0.0*y, -1.1*y, 0.9 } }
  44.   bounded_by { clipped_by }
  45.   scale <2, 1, 1>  // make it a long top
  46.   translate +0.98*y // move up to touch dish top
  47. }
  48.  
  49. #declare LCH_R1 = 0.4
  50. #declare LCH_R2 = 0.3
  51. #declare LCH_R3 = 0.1
  52.  
  53. //    /\
  54. //    \/
  55. //
  56. #declare LampCoverHandle_Shape =
  57. union
  58. {
  59.   cone { -1*y, LCH_R1, <+0.5,-0.5,0>, LCH_R2 }
  60.   cone { -1*y, LCH_R1, <-0.5,-0.5,0>, LCH_R2 }
  61.   cone { <+0.5,-0.55,0>, LCH_R2, 2*y, LCH_R3 }
  62.   cone { <-0.5,-0.55,0>, LCH_R2, 2*y, LCH_R3 }
  63.   scale <1,1,0.25> // flatten
  64.   scale 0.25 // shrink
  65.   translate 1.1*y
  66. }
  67.  
  68. //    _-___
  69. //     \___
  70. //
  71. #declare LampSpout_Clip_Shape =
  72. intersection
  73. {
  74.   union
  75.   {
  76.     cylinder { -1*y, 0*y, 1.0 } // bottom of spout...
  77.     cylinder { -1*z, 1*z, 0.2 translate -0.9*x scale x+2*y+z} // little "bimp" on end
  78.   }
  79.   plane { x, 0 } // only left half of spout
  80. }
  81.  
  82. #declare LampSpout_Shape =
  83. sphere
  84. {
  85.   0,1
  86.   clipped_by { object { LampSpout_Clip_Shape } }
  87.   bounded_by { clipped_by }
  88.   scale <2.5, 0.25, 0.25>  // make it a long trough
  89.   translate -0.5*x // move it over to stick out the side
  90. }
  91.  
  92. //
  93. //  O/-----\
  94. //   \-----/
  95. #declare LampHandle_Shape =
  96. union
  97. {
  98.   intersection // main handle loop
  99.   {
  100.   torus { 0.8, 0.2  sturm } // donut shape handle
  101.   sphere { 0, 1.5 scale <1,0.2,1> } // clip rounded
  102.   rotate 90*x // flip it up
  103.   scale <0.8, 0.2, 1>  // squish it flat
  104.   translate +2.2*x // move over to dish edge
  105.   }
  106. //  cylinder { -0.1*z, +0.1*z, 0.2 translate <1.4, 0.2, 0> } // little curl on end
  107.   sphere { 0, 0.2 scale <1,1,-0.2> translate <1.4, 0.2, 0> } // little curl on end
  108. }
  109.  
  110.  
  111. // ----------------------------------------------------------
  112.  
  113. #declare Magic_Lamp =
  114. union
  115. {
  116.  object { LampCoverHandle_Shape texture {Lamp_Texture} }
  117.  object { LampCover_Shape texture {Lamp_Texture} }
  118.  object { LampSpout_Shape texture {Lamp_Texture} }
  119.  object { LampDish_Shape texture {Lamp_Texture} }
  120.  object { LampHandle_Shape texture {Lamp_Texture} }
  121.  object { LampPedestal_Shape texture {Lamp_Texture} }
  122.  translate -0.6*y
  123. }
  124.